﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;

namespace Sales
{
    public partial class frmSetDB : Form
    {
        public SysConfig config;
        public static string config_dir = Application.StartupPath + "/config";
        public static string config_file = config_dir + "/config.xml";
        public Common2 common = new Common2();
        public frmSetDB()
        {
            InitializeComponent(); Init();
        }
        public void Init()
        {
            SysConfig model = Common2.GetConfig();//获取相关配置属性

            this.config = model;// 全局变量赋值
            this.ctxtAccount2.Text = model.SourceAccount;
            this.ctxtDatabaseName2.Text = model.SourceDatabaseName;
            this.ctxtPassWord2.Text = model.SourcePWD;
            this.ctxtServer2.Text = model.SourceServer;

            

        }
 
     
        private void glassButton1_Click(object sender, EventArgs e)
        {
            string account = this.ctxtAccount2.Text;
            string dataBase = this.ctxtDatabaseName2.Text;
            string passWord = this.ctxtPassWord2.Text;
            string server = this.ctxtServer2.Text;
            this.config.SourceAccount = account;
            this.config.SourceDatabaseName = dataBase;
            this.config.SourcePWD = passWord;
            this.config.SourceServer = server;

            Common2.SetConfig(config);
            MessageBox.Show("操作成功");
        }
    }
}
